<script setup>
import {ref,reactive} from "vue";
// import axios from "axios"
import myAxios from "../utils/axios";

let message = ref('');
let code = ref(0);

let msgObj=reactive({
    code:0,
    content:''
})


//post请求
let getMessage = async()=>{
    //解析-->解构
    let {content} = await myAxios.get("/api/rand.qinghua?format=json",{params:{"a":1}})
    // let {data} = await axios.post("http://forum.atguigu.cn/api/rand.qinghua?format=json",{"a":1})
    // let {data} = await axios.delete("http://forum.atguigu.cn/api/rand.qinghua?format=json")

    msgObj.content=content;
    //相当于拷贝
    // Object.assign(msgObj,data);
}

</script>

<template>
  <div>

    <button @click="getMessage()">土味情话</button>


    <h1>{{ msgObj }}</h1>
  </div>
</template>

<style scoped>

</style>
